Technical Q&AQTMTB 15 - SetTrackGWorld (1-May-95)SetTrackGWorld lets you force a track to draw into a particular GWorld. This GWorld may be different from that of the entire movie. After the track has drawn, it calls your transfer procedure to copy the track to the actual movie GWorld. When your transfer procedure is set, the current GWorld is set to the correct destination. You can also install a transfer procedure and set the GWorld to nil. This results in your transfer procedure being called only as a notification that the track has drawn--no transfer needs to take place pascal void SetTrackGWorld(Track theTrack, CGrafPtr port, GDHandle gdh, TrackTransferProc proc, long refCon) theTrack The track to set the proc to. port The port for the track to draw to, or nil to use the movie's GWorld. gdh GDevice associated with the port, or nil. proc Returns pointer to your transfer procedure, or nil to remove it. refCon Value to pass to your transfer procedure. typedef pascal OSErr (*TrackTransferProc)(Track t, long refCon); Errors: typedef struct { GWorldPtr gw; GWorldPtr efxTrack; GWorldPtr tween; short trackStat; Rect dst; WindowPtr wp; } mSpfx; typedef struct { Movie mv; MovieController mctl; Rect mrect; mSpfx *mefx; GWorldPtr backPict; } mvInfo, *mvPtr; /* these are the track transfer procedures, all they do is set a flag to */ /* indicate to the drawing completion proc that both tracks are ready */ pascal OSErr FrontTrackTransferProc(Track t, mSpfx *mfx) { mfx->trackStat |= 1; // first bit for the front, or main track return noErr; } pascal OSErr EfxTrackTransferProc(Track t, mSpfx *mfx) { mfx->trackStat |= 2; // second bit for the special effects track return noErr; } pascal OSErr MovieDrawingProc(Movie m, mvPtr mvp) {} void SetUpMovieEffect(Movie m, WindowPtr wp) { Track t; mSpfx *mfx; OSErr err; Rect bounds; mvPtr mvi; long numTracks; /* set up the transfer procedures for each track */ /* track 1 is the main movie track */ /* track 2 is the special effects track */ t = GetMovieIndTrack(m,1); SetTrackGWorld(t, mfx->gw, nil, (TrackTransferProc)FrontTrackTransferProc, (long) mfx); t = GetMovieIndTrack(m,2); SetTrackGWorld(t, mfx->efxTrack, nil, (TrackTransferProc)EfxTrackTransferProc, (long) mf /* set up the routine that actually does the drawing */ /* this routine is called after the movie toolbox draws all the tracks */ /* into the offscreen GWorlds set up above */ SetMovieDrawingCompleteProc(m, (MovieDrawingCompleteProcPtr)MovieDrawingProc, (long) mvi); GoToBeginningOfMovie(m); } Technical Q&A Previous Question | Contents | Next Question |